﻿@page
@model LoginModel
@inject IWebContext webContext 
@{
    dynamic dict = Locale.GetDictionary("Scada.Web.Pages.Login");
    ViewBag.Title = dict.PageTitle;
}

@section Styles {
    <link href="~/css/pages/login.min.css" rel="stylesheet" asp-append-version="true" />
}

<form method="post">
    <div class="container-fluid">
        <div id="divLogo" class="my-4 text-center">
            <a href="@CommonPhrases.WebsiteUrl" target="_blank"><img src="~/images/gear.png" alt="Logo" /></a>
        </div>
        <div id="divTitle" class="fs-1 my-4 text-center">@CommonPhrases.ProductName</div>
        <div id="divAlert" class="alert alert-danger alert-dismissible mx-auto" role="alert" asp-validation-summary="All">
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
            <div>@WebPhrases.CorrectErrors</div>
        </div>
        <div id="divLoginBox" class="border rounded p-4 mx-auto">
            <div class="mb-3">
                <label id="lblUsername" for="txtUsername" class="form-label">@dict.lblUsername</label>
                <input type="text" id="txtUsername" class="form-control" autofocus="autofocus" asp-for="Username" />
            </div>
            <div class="mb-3">
                <label id="lblPassword" for="txtPassword" class="form-label">@dict.lblPassword</label>
                <input type="password" id="txtPassword" class="form-control" asp-for="Password" />
            </div>
            @if (webContext.AppConfig.LoginOptions.RequireCaptcha)
            {
                <div class="mb-3">
                    <label id="lblCaptcha" for="txtCaptcha" class="form-label">@dict.lblCaptcha</label>
                    <img id="imgCaptcha" src="@Model.GetCaptchaImage()" />
                    <input type="text" id="txtCaptcha" class="form-control" autocomplete="off" asp-for="CaptchaCode" />
                </div>
            }
            <div class="row mb-3">
                <div class="col">
                    @if (webContext.AppConfig.LoginOptions.AllowRememberMe)
                    {
                        <div class="form-check">
                            <input type="checkbox" id="chkRememberMe" class="form-check-input" asp-for="RememberMe" />
                            <label id="lblRememberMe" class="form-check-label" for="chkRememberMe">@dict.lblRememberMe</label>
                        </div>
                    }
                </div>
                <div class="col-auto">
                    <button type="submit" id="btnLogin" class="btn btn-primary">@dict.btnLogin</button>
                </div>
            </div>
        </div>
    </div>
</form>
